Overview
For the FIRST Robotics competition, the team will use the programming language Java
.
There are several rules we keep to try to keep our code clean and working.
Programming Guidelines
-
Comment your code
Anything after//
or surrounded by/*
and*/
is ignored by the program and will turn green. Use this to explain sections of code. -
Name objects appropriately in CamelCase All objects should be named CamelCase, where the first letter of each word is capitalized:
-
Name methods appropriately in CamelCase starting with a lowercase For a method that raises the elevator, the first leter should be lowercase:
raiseElevator
-
No spaces in names
Java doesnt like spaces. -
All statements must end with
;
Statements are code that executes an action -
Blocks of code are contained within brackets
{ }
.
You can have blocks of code within blocks of code!
In the below example, the colored circles mark the beginning{
and ending}
of each block of code.
Note that the yellow and green blocks of code are within the red block of code, meaning that they may be run if the red block of code is run! The blue block of code is completely seperate.